﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace SpyApp
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {

            config.Routes.MapHttpRoute(
               name: "GetAllUser",
               routeTemplate: "api/Mobile/GetAllUser/{id}",
               defaults: new { controller = "User", action = "GetAllUser" }
           );
            config.Routes.MapHttpRoute(
                name: "GetUserById",
                routeTemplate: "api/Mobile/GetUserById/{id}",
                defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "GetUserById" }
            );
            config.Routes.MapHttpRoute(
                name: "Register",
                routeTemplate: "api/Account/Register/{id}",
                defaults: new { Id = RouteParameter.Optional, controller = "Account", action = "Register" }
            );
            config.Routes.MapHttpRoute(
                name: "AddNewUser",
                routeTemplate: "api/Mobile/AddNewUser/{id}",
                defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "AddNewUser" }
            );
            config.Routes.MapHttpRoute(
               name: "AddNewLocation",
               routeTemplate: "api/Mobile/AddNewLocation/{id}",
               defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "AddNewLocation" }
           );

            config.Routes.MapHttpRoute(
                name: "GetLocationFormDateToDate",
                routeTemplate: "api/Mobile/GetLocationFormDateToDate/{id}",
                defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "GetLocationFormDateToDate" }
            );
            config.Routes.MapHttpRoute(
                name: "Login",
                routeTemplate: "api/Mobile/Login/{id}",
                defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "Login" }
            );
            config.Routes.MapHttpRoute(
              name: "AddNewMessage",
              routeTemplate: "api/Mobile/AddNewMessage/{id}",
              defaults: new { Id = RouteParameter.Optional, controller = "Mobile", action = "AddNewMessage" }
            );
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );            

            // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
            // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
            // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
            //config.EnableQuerySupport();

            // To disable tracing in your application, please comment out or remove the following line of code
            // For more information, refer to: http://www.asp.net/web-api
            config.EnableSystemDiagnosticsTracing();
        }
    }
}
